<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="zh-CN">
<head>
	<meta charset="utf-8">
	<title>山西省审计厅档案综合管理系统</title>
	<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
    <jsp:include page="/inc/footer.jsp" flush="true"/>
    <jsp:include page="/inc/head.jsp" flush="true"/>
    <link rel="stylesheet" href="${basePath}/assets/shards-dashboards.1.1.0.min.css"/>
    <style>
       .panel-body .panel {
            background-color: transparent;
            border: 0;
            border-radius: 0;
            -webkit-box-shadow: none;
            box-shadow: none;
       }
       .panel-body #showMessage {
            padding: 15px;
            overflow-y: auto!important;
        }
       .panel-body #showMessage p  {
           margin:0;
       }
       .stats-small__percentage {
           padding: 0;
       }
    </style>
</head>
<body class="panel-body" style="padding-bottom:0px;">
<div class="panel panel-default">
    <div class="row">
        <div class="col-lg col-md-2 col-sm-6 mb-4">
            <div class="stats-small-1 stats-small--1 card card-small">
                <div class="card-body p-0 d-flex">
                    <div class="d-flex flex-column m-auto">
                        <div class="stats-small__data text-center">
                            <span class="stats-small__label">总卷数</span>
                            &nbsp;
                            <h6 class="stats-small__value">${countData.allVolCountData}</h6>
                        </div>
                        <div class="stats-small__data">
                            <span class="stats-small__percentage">卷</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-lg col-md-2 col-sm-6 mb-4">
            <div class="stats-small-1 stats-small--1 card card-small">
                <div class="card-body p-0 d-flex">
                    <div class="d-flex flex-column m-auto">
                        <div class="stats-small__data text-center">
                            <span class="stats-small__label">卷内件数</span>
                            &nbsp;
                            <h6 class="stats-small__value">${countData.allItemCountData}</h6>
                        </div>
                        <div class="stats-small__data">
                            <span class="stats-small__percentage">件</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-lg col-md-2 col-sm-6 mb-4">
            <div class="stats-small-1 stats-small--1 card card-small">
                <div class="card-body p-0 d-flex">
                    <div class="d-flex flex-column m-auto">
                        <div class="stats-small__data text-center">
                            <span class="stats-small__label">单件数</span>
                            &nbsp;
                            <h6 class="stats-small__value">${countData.allSinItemCountData}</h6>
                        </div>
                        <div class="stats-small__data">
                            <span class="stats-small__percentage">件</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-lg col-md-2 col-sm-6 mb-4">
            <div class="stats-small-1 stats-small--1 card card-small">
                <div class="card-body p-0 d-flex">
                    <div class="d-flex flex-column m-auto">
                        <div class="stats-small__data text-center">
                            <span class="stats-small__label">卷归档数</span>
                            &nbsp;
                            <h6 class="stats-small__value">${countData.allVolCoutDataArc}</h6>
                        </div>
                        <div class="stats-small__data">
                            <span class="stats-small__percentage">件</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-lg col-md-2 col-sm-12 mb-4">
            <div class="stats-small-1 stats-small--1 card card-small">
                <div class="card-body p-0 d-flex">
                    <div class="d-flex flex-column m-auto">
                        <div class="stats-small__data text-center">
                            <span class="stats-small__label">单件归档数</span>
                            &nbsp;
                            <h6 class="stats-small__value">${countData.allSinItemCountDataArc}</h6>
                        </div>
                        <div class="stats-small__data">
                            <span class="stats-small__percentage">件</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-lg col-md-2 col-sm-12 mb-4">
            <div class="stats-small-1 stats-small--1 card card-small">
                <div class="card-body p-0 d-flex">
                    <div class="d-flex flex-column m-auto">
                        <div class="stats-small__data text-center">
                            <span class="stats-small__label">借阅人次</span>
                            &nbsp;
                            <h6 class="stats-small__value">${countData. allBorrowCountData}</h6>
                        </div>
                        <div class="stats-small__data">
                            <span class="stats-small__percentage">次</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div id="under">
    <div>
        <div style="display: inline-block">
            <span>待办事宜</span>
        </div>
        <div style="display: inline-block;margin-left: 68%">
            <span>消息列表</span>
        </div>
    </div>
    <div>
        <div style="display: inline-block;width: 70%">
            <!-- 当前的代办table -->
            <table id="borAuditTable">
            </table>
        </div>
        <div id="showMessage" style="display: inline-block;float:right;margin-top:23px;width:28%;height: 441px;border:1px solid #DDDDDD;border-radius: 3px;background-color:#FFFFFF;overflow-y:scroll;">
        </div>
    </div>
</div>
<jsp:include page="/inc/footer.jsp" flush="true"/>
<%--<script src="${pageContext.request.contextPath }/js/bootstrap.min.js" type="text/javascript"></script>--%>
<script type="text/javascript">
    //当前代办table
    var $borAuditTable = $("#borAuditTable");
    
    $(function () {
        showBorAuditTable();
        //展示消息列表
        showMessage();
    })

    //当前未处理工作
    function showBorAuditTable(){
        $borAuditTable.bootstrapTable({
            url: "${basePath}/pcwindow/getMyAudit",
            queryParams: { activitiType: "allActiviti" },//此参数识别当前查询的正在运行的流程为何种流程borrowActiviti：借阅流程
            striped: true,
            search: false,
//            showRefresh: true,
//            showColumns: true,
            minimumCountColumns: 2,
            clickToSelect: true,
            detailView: false,
            detailFormatter: 'detailFormatter',
            pagination: true,
            pageList:[10,25,50],
            paginationLoop: false,
            sidePagination: 'server',
            silentSort: false,
            smartDisplay: false,
            escape: true,
            searchOnEnterKey: true,
            idField: 'id',
            maintainSelected: true,
            toolbar: '#toolbar',
            columns:[
                {field: 'id', visible:false},//借阅登记表的id
                {field: 'taskId', visible:false},//当前工作流的流程id
                {field: 'registerNum', title: '登记号', sortable: true, align: 'center'},
                {field: 'taskType', title: '申请类型', align: 'center',formatter:'taskTypeFormat'},
//                {field: 'borFileName', title: '借阅档案', align: 'center'},
//                {field: 'volCaseNum', title: '档案档号', align: 'center',formatter:'extend1Format'},
                {field: 'borUserName', title: '申请人', align: 'center'},
                {field: 'borDeptName', title: '申请部门', align: 'center',formatter:'borDeptNameFormat'},
                {field: 'createTime', title: '申请时间', align: 'center',formatter:'timeFormat'},
//                {field: 'borTime', title: '借阅时间', align: 'center',formatter:'LongToDateFormat'},
//                {field: 'planReturnTime', title: '申请结束时间', align: 'center',formatter:'planReturnFormat'},
//                {field: 'taskName', title: '当前节点', align: 'center',formatter:'taskNameFormat'},
//                {field: 'status', title: '流程状态', align: 'center',formatter:'statusFormat'},
                {field: 'action', title: '操作', align: 'center',formatter:'actionFormat'}
            ],
            onLoadSuccess:function(data){
                //无数据隐藏分页
                if(data && data.total == 0){
                    $('.fixed-table-pagination').hide()
                }

            }
        })
        $borAuditTable.bootstrapTable('resetView',{height:setHeight()});
    }

    //初始化当前执行的任务类型
    function taskTypeFormat(value,row,index){
        if(value==0){
            return "借阅";
        }else if(value==1){
            return "续借";
        }else{
            return "检索";
        }
    }

    //初始化value为时间的转换
    function timeFormat(value,row,index){
        return formatDateTime(value);
    }

    //初始化检索到期时间操作
    function planReturnFormat(value, row, index){
        if(typeof(value)=="number"){
            return formatshortDateTime(value);
        }else{
            var time = value.time;
            return formatshortDateTime(time);
        }
    }

    //初始化操作
    function actionFormat(value,row,index){
        return [
            <%--'<shiro:hasPermission name="cms:borAudit:myAudit"><a class="update" href="javascript:;" onclick="auditAction(' + row.id +','+row.taskId+','+index+')"  data-toggle="tooltip" title="audit">回复</a></shiro:hasPermission>&nbsp;&nbsp;&nbsp;',--%>
            '<shiro:hasPermission name="cms:borAudit:myAudit"><a class="update" href="javascript:;" onclick="toInfoAction('+index+')"  data-toggle="tooltip" title="audit">详情</a></shiro:hasPermission>'
        ].join('');
    }

    //跳转到详情审核
    function toInfoAction(index) {
        var data =  $borAuditTable.bootstrapTable('getData')[index];
        var taskType = data.taskType;
        if(taskType==0||taskType==1){
            window.location.href='${basePath}/pcwindow/toBorAudit';
        }else{
            window.location.href='${basePath}/pcwindow/searchManager';
        }
    }

    //初始化管理部门名称
    function borDeptNameFormat(value,row,index) {
        if(value!=null&&value!=""&&typeof(value) !="undefined"){
            return value;
        }else{
            return row.borDeptDescription;
        }
    }

    //显示消息列表
    function showMessage() {
        $.ajax({
            url:"${basePath}/pcwindow/getMessageList",
            type:"get",
            data:"",
            dataType:"json",
            success:function (data) {
                $("#showMessage").empty();
                if(!data || data[0] == "" ){
                    $("#showMessage").append("<div style='text-align:center;'>没有找到匹配的记录</div>");
                }else {
                    for(var index in data){
                        var str = '<div style="border-bottom:1px solid #EBEBEB;">';
                        str += '<p>';
                        str += data[index];
                        str += '</p>';
                        str += '</div>';
                        var $str = $(str);
                        $("#showMessage").append($str);
                    }
                }
            }
        });
    }

    /**
     * 表格高度自适应
     * @return
     * winTop 浏览器视口高度
     * header 顶部通栏
     * breadcrumb 面包屑
     * mainFooter 底部
     */
    function setHeight(){
        var winTop = $(window.top).height(),
            header = window.top.document.querySelector('.main-header').offsetHeight,
            breadcrumb =  window.top.document.querySelector('.breadcrumb').offsetHeight,
            mainFooter = window.top.document.querySelector('.main-footer').offsetHeight;
        return winTop-header-breadcrumb-mainFooter-173;
    }
</script>
</body>
</html>